using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spinning.Spinning.Interface;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input.Touch;

namespace Spinning.Spinning.Entity.Particle
{
    class FireEnemy:Enemy,ITouchable
    {
        public delegate void TouchEventHandler(BaseEntity entity, TouchLocation touchLocation);
        public TouchEventHandler OnTouchEvent, OnReleaseEvent, OnHoldEvent;

        public bool Contain(Microsoft.Xna.Framework.Vector2 position)
        {
            Vector2 topLeft = Position - Origin * new Vector2( _frameSize.X, _frameSize.Y) * Scale;
            Vector2 rightDown = topLeft + new Vector2(_frameSize.X, _frameSize.Y) * Scale;
            bool t=(position.X > topLeft.X && position.X < rightDown.X && position.Y > topLeft.Y && position.Y < rightDown.Y);

            float leng = (position - Position).Length();
            t = leng < 80;
            return t;
        }

        public void OnTouch(TouchLocation touchLocation)
        {
            if (OnTouchEvent != null)
                OnTouchEvent(this, touchLocation);
        }

        public void OnRelease(TouchLocation touchLocation)
        {
            if (OnReleaseEvent != null)
                OnReleaseEvent(this, touchLocation);
        }

        public void OnHold(TouchLocation touchLocation)
        {
            if (OnHoldEvent != null)
                OnHoldEvent(this, touchLocation);
        }
    }
}
